package com.dlwx.parttimetalent.ui;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.dlwx.parttimetalent.R;
import com.dlwx.parttimetalent.adapter.AttentionClassifyAdapter;
import com.dlwx.parttimetalent.base.BaseActivity;
import com.dlwx.parttimetalent.bean.BannerHeadBean;
import com.dlwx.parttimetalent.bean.BaseBean;
import com.dlwx.parttimetalent.bean.ClassIntentListBean;
import com.dlwx.parttimetalent.bean.UserHeadBean;
import com.dlwx.parttimetalent.comm.Constant;
import com.dlwx.parttimetalent.comm.Http;
import com.dlwx.parttimetalent.utils.DealResult;
import com.dlwx.parttimetalent.utils.OkgoUtil;
import com.dlwx.parttimetalent.utils.SPUtils;
import com.dlwx.parttimetalent.utils.StringUtil;
import com.dlwx.parttimetalent.utils.ToChatUtil;
import com.dlwx.parttimetalent.utils.ToastUtils;
import com.dlwx.parttimetalent.views.ShareDialog;
import com.github.jdsjlzx.ItemDecoration.DividerDecoration;
import com.github.jdsjlzx.interfaces.OnItemClickListener;
import com.github.jdsjlzx.interfaces.OnRefreshListener;
import com.github.jdsjlzx.recyclerview.LRecyclerView;
import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter;
import com.github.jdsjlzx.view.CommonHeader;
import com.google.gson.reflect.TypeToken;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;
import com.sina.weibo.sdk.share.WbShareCallback;
import com.sina.weibo.sdk.share.WbShareHandler;
import com.tbruyelle.rxpermissions2.RxPermissions;
import com.youth.banner.Banner;
import com.youth.banner.listener.OnBannerListener;
import com.youth.banner.loader.ImageLoader;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class AttentionUserClassifyActivity extends BaseActivity implements WbShareCallback {

    @BindView(R.id.recyclerView)
    LRecyclerView recyclerView;
    @BindView(R.id.tv_send)
    TextView tvSend;
    @BindView(R.id.tv_attention)
    TextView tvAttention;
    @BindView(R.id.ll_bottom)
    LinearLayout llBottom;
    @BindView(R.id.image_back)
    ImageView imageBack;
    @BindView(R.id.image_share)
    ImageView imageShare;
    @BindView(R.id.image_edit)
    ImageView imageEdit;
    private String chatName;
    private String headUrl;

    private AttentionClassifyAdapter mAdapter;
    private TextView tvAttent;
    private TextView tvVisitor;
    private TextView tvPosition;
    //    private TextView tvIndustry;
//    private TextView tvUnit;
    private ImageView iconVip;
    private ImageView imageHeader, imageAge;
    private TextView tvAutonym, tv_setting;
    private TextView tvRating1;
    private TextView tvRating2;
    private TextView tvName;
    private TextView tvId;
    private TextView tvAddress;
    private TextView tvGrade;
    private TextView tvStatus;
    private TextView tvSignature, tvAge, tvHeight, tvWeight, tvEducation, tvCertificate, tvAuthname, tvMarry, tvMajor, tv_famous, tv_boss,tv_zodiac;
    private LinearLayout llAge;
    private Banner banner_head;
    private String listId;
    private Intent intentRemark;
    private String curruserId;
    private WbShareHandler shareHandler;
    private RxPermissions rxPermissions;
    private String shareUrl;
    private String qrCode;
    private int userId;
    private LRecyclerViewAdapter lRecyclerViewAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_attention_user_classify);
        ButterKnife.bind(this);
        listId = getIntent().getStringExtra("listId");
        userId = (int) SPUtils.get(this, Constant.USER_ID, 0);
        initView();

    }

    @Override
    protected void onResume() {
        super.onResume();
        refresh();
    }

    private void getListDatas(String listId) {
        loadingDialog.show();
        OkgoUtil.post(Http.DetailsIntentList, AttentionUserClassifyActivity.this)
                .params("listid", listId)
                .execute(new StringCallback() {
                    @Override
                    public void onSuccess(Response<String> response) {
                        loadingDialog.dismiss();
                        ClassIntentListBean parentBean = DealResult.getInstance().dealDatas(AttentionUserClassifyActivity.this, response, new TypeToken<ClassIntentListBean>() {
                        }.getType());
                        if (parentBean == null) {
                            return;
                        }
                        int code = parentBean.getCode();
                        if (code == Constant.SUCESS) {
                            setListDatas(parentBean.getBody());
                        } else {
//                            ToastUtils.toastForShort(AttentionUserClassifyActivity.this,parentBean.getResult());
                        }
                    }

                    @Override
                    public void onError(Response<String> response) {
                        loadingDialog.dismiss();
                        recyclerView.refreshComplete(mAdapter.getItemCount());
                        super.onError(response);
                        ToastUtils.toastForShort(AttentionUserClassifyActivity.this, getString(R.string.bad_net));
                    }
                });
    }

    private void setListDatas(List<ClassIntentListBean.BodyBean> body) {
        mAdapter.addAll(body);
        recyclerView.refreshComplete(mAdapter.getItemCount());
    }

    private void getHeader(String listId) {
        String longi = (String) SPUtils.get(AttentionUserClassifyActivity.this, Constant.LOCATION_LON, "116.395645");
        String lat = (String) SPUtils.get(AttentionUserClassifyActivity.this, Constant.LOCATION_LAT, "39.929985");
        OkgoUtil.post(Http.DetailsTop, AttentionUserClassifyActivity.this)
                .params("listid", listId)
                .params("labelid", "")
                .params("labeltype", "")
                .params("type", "2")
                .params("long", longi)
                .params("lat", lat)
                .execute(new StringCallback() {
                    @Override
                    public void onSuccess(Response<String> response) {
                        UserHeadBean parentBean = DealResult.getInstance().dealDatas(AttentionUserClassifyActivity.this, response, new TypeToken<UserHeadBean>() {
                        }.getType());
                        if (parentBean == null) {
                            return;
                        }
                        int code = parentBean.getCode();
                        if (code == Constant.SUCESS) {
                            setHeadDatas(parentBean.getBody());
                        } else {
                            ToastUtils.toastForShort(AttentionUserClassifyActivity.this, parentBean.getResult());
                        }
                    }

                    @Override
                    public void onError(Response<String> response) {
                        super.onError(response);
                        ToastUtils.toastForShort(AttentionUserClassifyActivity.this, getString(R.string.bad_net));
                    }
                });
    }

    private void setHeadDatas(UserHeadBean.BodyBean body) {
        int mrt = body.getIsmr();
        int boss = body.getIshydl();
        curruserId = body.getCurruserid();
        curruserId = body.getCurruserid();
        if (!TextUtils.equals(curruserId, userId + "")) {
            tv_setting.setVisibility(View.GONE);
            imageEdit.setVisibility(View.GONE);
        } else {
            llBottom.setVisibility(View.GONE);
        }
        shareUrl = body.getShareurl();
        qrCode = body.getQrcode();
        if (mrt == 1) {
            tv_famous.setVisibility(View.VISIBLE);
        }
        if (boss == 1) {
            tv_boss.setVisibility(View.VISIBLE);
        }
        intentRemark = new Intent(AttentionUserClassifyActivity.this, RemarkNameActivity.class);
        intentRemark.putExtra("id", body.getCurruserid());
        if (body.getIsfollow() == 1) {
            tvAttention.setText("已关注");
        } else {
            tvAttention.setText("关注Ta");
        }
        ;
        final List<BannerHeadBean> bannerHeadBeanList = new ArrayList<>();
        List<UserHeadBean.BodyBean.ImgBean> images = body.getImg();
        List<UserHeadBean.BodyBean.ViedoBean> videos = body.getViedo();
        if (images != null) {
            for (UserHeadBean.BodyBean.ImgBean imgBean : images) {
                BannerHeadBean bannerHeadBean = new BannerHeadBean();
                bannerHeadBean.setUserimg(imgBean.getUserimg());
                bannerHeadBean.setUserviedo("");
                bannerHeadBeanList.add(bannerHeadBean);
            }
        }
        if (videos != null) {
            for (UserHeadBean.BodyBean.ViedoBean viedoBean : videos) {
                BannerHeadBean bannerHeadBean = new BannerHeadBean();
                bannerHeadBean.setUserimg(viedoBean.getCover());
                bannerHeadBean.setUserviedo(viedoBean.getUserviedo());
                bannerHeadBeanList.add(bannerHeadBean);
            }
        }
        banner_head.setImages(bannerHeadBeanList);
        banner_head.setImageLoader(new ImageLoader() {
            @Override
            public void displayImage(Context context, Object bean, ImageView imageView) {
                //Glide 加载图片简单用法
                String path = ((BannerHeadBean) bean).getUserimg();
                Glide.with(context).load(path).into(imageView);
            }
        });

        banner_head.setOnBannerListener(new OnBannerListener() {
            @Override
            public void OnBannerClick(int position) {
                Intent i = new Intent();
                String video = bannerHeadBeanList.get(position).getUserviedo();
                String img = bannerHeadBeanList.get(position).getUserimg();
                if (TextUtils.isEmpty(video)) {
                    i.putExtra("url", img);
                    i.setClass(AttentionUserClassifyActivity.this, ShowImageActivity.class);
                } else {
                    i.putExtra("url", video);
                    i.setClass(AttentionUserClassifyActivity.this, VideoPaylerActivity.class);
                }
                startActivity(i);
            }
        });
        if (!this.isFinishing()) {
            banner_head.start();
        }
        headUrl = body.getHeadurl();
        if (!this.isFinishing()) {
            Glide.with(this).load(body.getHeadurl()).into(imageHeader);
        }
        tvRating1.setText(body.getCreditrating() + "");
        tvRating2.setText(body.getAuthlevel() + "");
        tvAttent.setText("关注：" + body.getFollownum());
        tvVisitor.setText("访客：" + body.getVisitornum());
        tvPosition.setText("房产信息：" + body.getJob_position());
//        tvIndustry.setText("所属行业："+body.getJob_class());
//        tvUnit.setText("单位名称："+body.getWorkunit());
        String remarkName = body.getRemarkName();
        if (TextUtils.isEmpty(remarkName)) {
            chatName = StringUtil.subName(body.getNickname());
            tvName.setText(StringUtil.subName(body.getNickname()));
        } else {
            chatName = StringUtil.subName(remarkName);
            tvName.setText(StringUtil.subName(remarkName));
        }
//      tvName.setText(body.getNickname());
        tvId.setText("(" + body.getUsernumber() + ")");
        tvAddress.setText(body.getRange());
        tvGrade.setText(body.getScore() + "分");
        tvStatus.setText(body.getCurrStatus() + body.getMonorate());
        tvSignature.setText(body.getUsersign());
        UserHeadBean.BodyBean.AgeBean ageBean = body.getAge();
        if (TextUtils.isEmpty(ageBean.getValue())) {
            llAge.setVisibility(View.GONE);
        } else {
            tvAge.setText(ageBean.getValue());
            if (ageBean.getCorlor() == 1) {
                llAge.setBackgroundColor(ContextCompat.getColor(AttentionUserClassifyActivity.this, R.color.colorPrimary));
                imageAge.setBackgroundResource(R.mipmap.icon_nansheng);
            } else {
                llAge.setBackgroundColor(ContextCompat.getColor(AttentionUserClassifyActivity.this, R.color.label_pink));
                imageAge.setBackgroundResource(R.mipmap.icon_nvsheng);
            }
        }

//
        UserHeadBean.BodyBean.HeightBean heightBean = body.getHeight();
        if (TextUtils.isEmpty(heightBean.getValue())) {
            tvHeight.setVisibility(View.GONE);
        } else {
            tvHeight.setVisibility(View.VISIBLE);
            tvHeight.setText(heightBean.getValue() + "cm");
        }
//
        UserHeadBean.BodyBean.WeightBean weightBeanBean = body.getWeight();
        if (TextUtils.isEmpty(weightBeanBean.getValue())) {
            tvWeight.setVisibility(View.GONE);
        } else {
            tvWeight.setVisibility(View.VISIBLE);
            tvWeight.setText(weightBeanBean.getValue() + "kg");
        }
//
        UserHeadBean.BodyBean.EducationBean educationBean = body.getEducation();
        if (TextUtils.isEmpty(educationBean.getValue())) {
            tvEducation.setVisibility(View.GONE);
        } else {
            tvEducation.setVisibility(View.VISIBLE);
            tvEducation.setText(educationBean.getValue());
        }
//
        UserHeadBean.BodyBean.AuthnameBean authnameBean = body.getAuthname();
        if (authnameBean.getCorlor() == 66) {
            tvAuthname.setVisibility(View.GONE);
            tvAutonym.setVisibility(View.GONE);
        } else {
            tvAuthname.setVisibility(View.VISIBLE);
            tvAutonym.setVisibility(View.VISIBLE);
//            tvAuthname.setText(authnameBean.getValue());
        }

        UserHeadBean.BodyBean.MajorBean majorBean = body.getMajor();
        if (TextUtils.isEmpty(majorBean.getValue())) {
            tvMajor.setVisibility(View.GONE);
        } else {
            tvMajor.setVisibility(View.VISIBLE);
            tvMajor.setText(majorBean.getValue());
        }
        UserHeadBean.BodyBean.MarriageBean marriageBean = body.getMarriage();
        if (TextUtils.isEmpty(marriageBean.getValue())) {
            tvMarry.setVisibility(View.GONE);
        } else {
            tvMarry.setVisibility(View.VISIBLE);
            tvMarry.setText(marriageBean.getValue());
        }
        UserHeadBean.BodyBean.DriverBean driverBean = body.getDriver();
        if (TextUtils.isEmpty(driverBean.getValue())) {
            tvCertificate.setVisibility(View.GONE);
        } else {
            tvCertificate.setVisibility(View.VISIBLE);
            tvCertificate.setText(driverBean.getValue());
        }
        UserHeadBean.BodyBean.ZodiacBean zodiacBean = body.getZodiac();
        if (TextUtils.isEmpty(zodiacBean.getValue())) {
            tv_zodiac.setVisibility(View.GONE);
        } else {
            tv_zodiac.setVisibility(View.VISIBLE);
            tv_zodiac.setText(zodiacBean.getValue());
        }
    }
    private void refresh(){
        getHeader(listId);
        mAdapter.clear();
        lRecyclerViewAdapter.notifyDataSetChanged();
        getListDatas(listId);
    }

    private void initView() {
        rxPermissions = new RxPermissions(this);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        mAdapter = new AttentionClassifyAdapter(this);
        mAdapter.setDataList(new ArrayList<ClassIntentListBean.BodyBean>());
         lRecyclerViewAdapter = new LRecyclerViewAdapter(mAdapter);
        //divider
        DividerDecoration divider = new DividerDecoration.Builder(this)
                .setHeight(R.dimen.size_1)
//                .setPadding(R.dimen.divider_padding)
                .setColorResource(R.color.bg)
                .build();
        recyclerView.setHasFixedSize(true);
        recyclerView.addItemDecoration(divider);
        recyclerView.setAdapter(lRecyclerViewAdapter);
        recyclerView.setLoadMoreEnabled(false);
        recyclerView.setPullRefreshEnabled(true);
        recyclerView.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh() {
                refresh();
            }
        });
//        recyclerView.setOnLoadMoreListener(new OnLoadMoreListener() {
//            @Override
//            public void onLoadMore() {
//
//            }
//        });
        lRecyclerViewAdapter.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(View view, int position) {
                ClassIntentListBean.BodyBean bean = mAdapter.getDataList().get(position);
                Intent i = null;
                if (TextUtils.equals("" + userId, curruserId)) {
                    i = new Intent(AttentionUserClassifyActivity.this, EditLabelActivity.class);
                } else {
                    i = new Intent(AttentionUserClassifyActivity.this, ConfirmOrderActivity.class);
                    i.putExtra("curruserId", curruserId);
                    i.putExtra("labeId", bean.getLabelid() + "");
                    i.putExtra("labelType", bean.getLabeltype() + "");
                }
                startActivity(i);
            }
        });
        addHeader(lRecyclerViewAdapter);
    }

    private void addHeader(LRecyclerViewAdapter lRecyclerViewAdapter) {
        CommonHeader header = new CommonHeader(this, R.layout.header_user_classify);
        final ImageView imageShare = header.findViewById(R.id.image_share);
        banner_head = header.findViewById(R.id.banner);
        iconVip = header.findViewById(R.id.icon_vip);
        tv_setting = header.findViewById(R.id.tv_setting);
        imageHeader = header.findViewById(R.id.image_header);
        tvAttent = header.findViewById(R.id.tv_attention);
        tvVisitor = header.findViewById(R.id.tv_visitor);
        tvPosition = header.findViewById(R.id.tv_position);
//        tvIndustry=header.findViewById(R.id.tv_industry);
//        tvUnit=header.findViewById(R.id.tv_unit);
        tvAutonym = header.findViewById(R.id.tv_autonym);
        tvRating1 = header.findViewById(R.id.tv_rating1);
        tvRating2 = header.findViewById(R.id.tv_rating2);
        tvName = header.findViewById(R.id.tv_name);
        tvId = header.findViewById(R.id.tv_id);
        tvAddress = header.findViewById(R.id.tv_address);
        tvGrade = header.findViewById(R.id.tv_grade);
        tvStatus = header.findViewById(R.id.tv_status);
        tvSignature = header.findViewById(R.id.tv_signature);
        tvMarry = header.findViewById(R.id.tv_marry);
        tv_zodiac = header.findViewById(R.id.tv_zodiac);
        tvMajor = header.findViewById(R.id.tv_major);
        tv_famous = header.findViewById(R.id.tv_famous);
        tv_boss = header.findViewById(R.id.tv_boss);

        tvAge = header.findViewById(R.id.tv_age);
        imageAge = header.findViewById(R.id.image_age);
        llAge = header.findViewById(R.id.ll_age);
        tvHeight = header.findViewById(R.id.tv_height);
        tvWeight = header.findViewById(R.id.tv_weight);
        tvEducation = header.findViewById(R.id.tv_education);
        tvCertificate = header.findViewById(R.id.tv_certificate);
        tvAuthname = header.findViewById(R.id.tv_authname);
        LinearLayout ll_user_info = header.findViewById(R.id.ll_user_info);
        ll_user_info.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = null;
                if (TextUtils.equals("" + userId, curruserId)) {
                    i = new Intent(AttentionUserClassifyActivity.this, OrderReceActivity.class);
                } else {
                    i = new Intent(AttentionUserClassifyActivity.this, AttentionUser2Activity.class);
                    i.putExtra("listId", curruserId);
                }
                startActivity(i);

            }
        });
        imageHeader.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = null;
                i = new Intent(AttentionUserClassifyActivity.this, AttentionUser2Activity.class);
                i.putExtra("listId", curruserId);
                startActivity(i);
            }
        });
        LinearLayout llRating1 = header.findViewById(R.id.ll_rating1);
        LinearLayout llRating2 = header.findViewById(R.id.ll_rating2);
        llRating1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ToastUtils.toastForLongMiddle(AttentionUserClassifyActivity.this, "累计交易金额，提升西瓜信用等级。");
            }
        });
        llRating2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ToastUtils.toastForLongMiddle(AttentionUserClassifyActivity.this, "优先推荐星级高用户，认证中心完成认证。");
            }
        });
        lRecyclerViewAdapter.addHeaderView(header);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            getColor(R.color.colorAccent);
        }
    }

    @OnClick({R.id.tv_send, R.id.tv_attention, R.id.image_share, R.id.image_back,R.id.image_edit})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.image_edit:
                startActivity(new Intent(this,DaRenActivity.class));
                break;
            case R.id.tv_send:
                ToChatUtil.chat(this, curruserId, headUrl, chatName);
                break;
            case R.id.tv_attention:
                doAttention();
                break;
            case R.id.image_share:
                doShare();
                break;
            case R.id.image_back:
                AttentionUserClassifyActivity.this.finish();
                break;
        }
    }

    private void doShare() {
        View contentView = LayoutInflater.from(AttentionUserClassifyActivity.this).inflate(R.layout.popup_more, null);
        TextView tvRemark = contentView.findViewById(R.id.tv_remark);
        TextView tvMoney = contentView.findViewById(R.id.tv_money);
        TextView tvShare = contentView.findViewById(R.id.tv_share);
        TextView tvAttention = contentView.findViewById(R.id.tv_attention);
        final PopupWindow popWnd = new PopupWindow(AttentionUserClassifyActivity.this);
        popWnd.setContentView(contentView);
        popWnd.setBackgroundDrawable(null);
        popWnd.setWidth(380);
        popWnd.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
        popWnd.setOutsideTouchable(true);
        if (!popWnd.isShowing()) {
            popWnd.showAsDropDown(imageShare, -360, 20);
        }
        tvRemark.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                popWnd.dismiss();
                startActivityForResult(intentRemark, 0);
            }
        });
        tvMoney.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                popWnd.dismiss();
                ShareDialog dialog = new ShareDialog(AttentionUserClassifyActivity.this, shareUrl);
                dialog.show();
            }
        });
        tvShare.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                popWnd.dismiss();
                ShareDialog dialog = new ShareDialog(AttentionUserClassifyActivity.this, qrCode);
                dialog.show();

            }
        });
        tvAttention.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                doAttention();
                popWnd.dismiss();
            }
        });
    }

    private void doAttention() {
        loadingDialog.show();
        OkgoUtil.post(Http.FollowUser, AttentionUserClassifyActivity.this)
                .params("followuserid", curruserId)
                .execute(new StringCallback() {
                    @Override
                    public void onSuccess(Response<String> response) {
                        loadingDialog.dismiss();
                        BaseBean parentBean = DealResult.getInstance().dealDatas(AttentionUserClassifyActivity.this, response, new TypeToken<BaseBean>() {
                        }.getType());
                        if (parentBean == null) {
                            return;
                        }
                        int code = parentBean.getCode();
                        if (code == Constant.SUCESS) {
                            getHeader(listId);
                        } else {
                        }
                        ToastUtils.toastForShort(AttentionUserClassifyActivity.this, parentBean.getResult());
                    }

                    @Override
                    public void onError(Response<String> response) {
                        loadingDialog.dismiss();
                        super.onError(response);
                        ToastUtils.toastForShort(AttentionUserClassifyActivity.this, getString(R.string.bad_net));
                    }
                });
    }

    @Override
    public void onWbShareSuccess() {
        ToastUtils.toastForShort(this, "分享成功");

    }

    @Override
    public void onWbShareCancel() {

    }

    @Override
    public void onWbShareFail() {
        ToastUtils.toastForShort(this, "分享失败");
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
//        shareHandler.doResultIntent(intent,this);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == Constant.FIVE) {
            getHeader(listId);
        } else {
            super.onActivityResult(requestCode, resultCode, data);
        }
    }
}
